package com.ukao.cashregister.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.ReceiveProListBean;

import java.util.List;

/**
 * Created by ukaodev on 2017/6/14.
 */

public class ReceiveProListAdapter extends CommonAdapter<ReceiveProListBean> {


    private  boolean ishow;

    public ReceiveProListAdapter(Context context, List<ReceiveProListBean> datas) {
        super(context, datas, R.layout.arrive_shop_recycler_item);

    }
    public void  setShowBackgroundColor(boolean ishow){
        this.ishow=ishow;
    }

    @Override
    public void convert(ViewHolder holder, ReceiveProListBean item) {
        ImageView accessory = holder.getView(R.id.order_detail_accessory);
            if (ishow){
       if (holder.getLayoutPosition() == 0) {
            holder.itemView.setBackgroundColor(mContext.getResources().getColor(R.color.yellow));
        } else {
            holder.itemView.setBackgroundColor(mContext.getResources().getColor(R.color.transparent));
        }
            }
        if (item.getOrderProType()==2){
            accessory.setVisibility(View.VISIBLE);
        }else{
            accessory.setVisibility(View.GONE);
        }


        holder.setText(R.id.scanCode, item.getScanCode());
        holder.setText(R.id.orderNo, item.getOrderNo());
        holder.setText(R.id.productName, item.getProductName());
        holder.setText(R.id.serviceName, item.getServiceName());





    }


}
